(require 'header2)
(defvar header-project-name emax-id)
;; (defun c-mode-config-header ()
;;   (interactive)
;;   (setq header-copyright-notice "Copyright@dimilar")
;;   (make-local-variable 'user-full-name)
;;   (make-local-variable 'user-mail-address)
;;   (setq user-full-name "Shulei Zhu")
;;   (setq user-mail-address "schuleichu@gmail.com")
;;   (setq make-header-hooks '(header-mode-line
;;                              header-blank
;;                              ;;header-rcs
;;                              ;;header-AFS
;;                              header-file-name
;;                              ;; header-project-name
;;                              header-file-description
;;                              ;; header-creation-date
;;                              ;;header-rcs
;;                              header-author
;;                              header-author-email
;;                              header-modification-author
;;                              header-modification-date
;;                              header-update-count
;;                              header-blank
;;                              header-copyright
;;                              header-blank
;;                              header-status
;;                              ;; Re-enable the following lines if you wish
;;                              header-blank
;;                              header-history
;;                              header-purpose
;;                              header-toc
;;                              header-blank
;;                              header-end-comment

;;                              ))
;;   (setq file-header-update-alist nil)
;;   (progn
;;     (register-file-header-action "[ \t]Update Count[ \t]*: "
;;                                  'update-write-count)
;;     (register-file-header-action "[ \t]Last Modified By[ \t]*: "
;;                                  'update-last-modifier)
;;     (register-file-header-action "[ \t]Last Modified On[ \t]*: "
;;                                  'update-last-modified-date)
;;     (register-file-header-action " File            : *\\(.*\\) *$" 'update-file-name)
;;     ))


(defun header-file-name ()
  "Places the buffer's file name and leaves room for a description."
  (insert header-prefix-string "File            : " (buffer-name) "\n")
  (setq return-to (1- (point))))
(defun header-project-name ()
  (insert header-prefix-string "Program/Library : " header-project-name "\n"))
(defun header-file-description()
  (insert header-prefix-string "Description     : \n"))
(defun header-author-email ()
  (insert header-prefix-string "Mail            : " user-mail-address "\n"))

(defun header-end-comment ()
  (if comment-end
      (insert  comment-end "\n")))
(defun update-file-name ()
  (beginning-of-line)
  ;; verify that we are looking at a file name for this mode
  (if (looking-at
       (concat (regexp-quote (header-prefix-string)) "File            : *\\(.*\\) *$"))
      (progn
        (goto-char (match-beginning 1))
        (delete-region (match-beginning 1) (match-end 1))
        (insert (file-name-nondirectory (buffer-file-name)) )
        )))


(defun start-ecb()
  (interactive)
  ;; load up abbrevs for these modes
  (require 'ecb)
  )

;;(color-theme-initialize)
;; )
;;(color-theme-blue-gnus)


;; (setq load-path (cons "/scratch/emacs/share/emacs/xref/emacs" load-path))
;; (setq exec-path (cons "/scratch/emacs/share/emacs/xref" exec-path))
;; (load "xrefactory")

(defun start-jde()
  (interactive)
  ;;(add-to-list 'load-path (concat emax-maindir "cedet/common"))
  ;;(load "cedet")
  (require 'jde)
  (require 'jmaker)
  (require 'jjar)
;;  (require 'jsee)
  (require 'jde-eclipse-compiler-server)
;;  (setq jde-compiler '(("eclipse java compiler server" . emax-eclipse-jcs)))
  (setq jde-compiler '(("eclipse java compiler server" "/usr/local/eclipse/plugins/org.eclipse.jdt.core_3.6.2.v_A76_R36x.jar")))
;;  (setq jde-complete-function (quote jde-complete-menu))
  ;;(setq jde-ant-home "/scratch/progs/ant/bin/ant")
  ;;(setq jde-ant-program "ant")
  (setq jmaker-end-of-line-format (quote unix))
  (setq jmaker-java-compiler-options "-classpath /usr/local/eclipse/plugins/org.eclipse.jdt.core_3.6.2.v_A76_R36x.jar org.eclipse.jdt.internal.compiler.batch.Main -g -Xemacs -noExit")
  ;;(setq jde-compiler emax-eclipse-jcs)

  (add-hook 'jde-mode-hook
            (lambda () (subword-mode 1)))
  (add-hook 'jde-mode-hook
            (lambda () (c-toggle-auto-hungry-state 1)))
  (add-hook 'jde-mode-hook
            (lambda () (c-toggle-auto-newline 1)))
  (add-hook 'jde-mode-hook 
            (lambda () (local-set-key [return] 'c-context-line-break)))
  (add-hook 'jde-mode-hook 
            (lambda () (local-set-key "\;" 'insert-semicolon)))
  (add-hook 'jde-mode-hook 
            (lambda () (local-set-key "\C-m" 'end-of-newline)))
  (add-hook 'jde-mode-hook 'my-c-mode-auto-pair)
  )


(defun start-others()
  (interactive)
  (load esop)
  (require 'swbuff)
  (setq swbuff-exclude-buffer-regexps 
        '("^ " "\\*.*\\*"))

  (setq swbuff-status-window-layout 'scroll)
  (setq swbuff-clear-delay 1)
  (setq swbuff-separator "|")
  (setq swbuff-window-min-text-height 1)
  (load "desktop") 
  (desktop-load-default) 
  (desktop-read)
  (require 'session)
  (add-hook 'after-init-hook 'session-initialize)
  (require 'post)
  (put 'scroll-left 'disabled nil)
  )

;; (defun doc-mode
;;   (interactive)
;;   (load "cedet")
;;   (require 'doc-mode))
